package edu.hwadee.action;

import java.util.List;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ModelDriven;

import edu.hwadee.entity.Storage;

public class StorageAction extends BasicAction implements ModelDriven<Storage> {

	private static final long serialVersionUID = 1L;
	private Storage storage;
	
	@Override
	public Storage getModel() {
		if(storage == null)
			setStorage(new Storage());
		return storage;
	}

	public String showAll() {
		List<Storage> list = getStorageServiceImpl().showAll();
		ServletActionContext.getRequest().getSession().setAttribute("storagelist", list);
		return "success";
	}
	
	public Storage getStorage() {
		return storage;
	}

	public void setStorage(Storage storage) {
		this.storage = storage;
	}
	
}
